<?php
// +----------------------------------------------------------------------
// | 跃飞 [ 将来的你一定会感激现在奋斗的自己 ]
// +----------------------------------------------------------------------
// | Author: 钟贵廷
// +----------------------------------------------------------------------
// | Author URI: https://git.oschina.net/yeafy
// +----------------------------------------------------------------------
// | weChat:gt845272922  qq:845272922
// +----------------------------------------------------------------------


namespace app\yeafy\simpleFactory\demo3;


class OrderFactory
{
    private static $instance;

    /**
     * @desc:获取对象
     * @author 钟贵廷
     * @WeChat gt845272922
     * @qq 845272922
     * @param $type
     * @return RefurbishedOrder|RepairOrder|null
     */
    public static function getInstance($type)
    {
        switch ($type)
        {
            case 'repair':
                self::$instance = new RepairOrder();
                break;
            case 'refurbish':
                self::$instance = new RefurbishedOrder();
                break;
            default:
                self::$instance = null;
        }
        return self::$instance;
    }
}